<template>
	<view>
		<!-- <view class="top_box">
			<view class="search_box">
				<image src="../../static/ss1.png"></image>
				<input type="text" placeholder="搜索" placeholder-class="input_search">
				<view class="btn">搜索</view>
			</view>
			<view class="message_box">
				<view class="message_item" @click="navSystemMessage">
					<image src="@/static/message@1.png"></image>
					<view class="message">
						<text>系统消息</text>
						<text>(0)</text>
					</view>
				</view>
				<view class="message_item">
					<image src="@/static/message@2.png"></image>
					<view class="message">
						<text>其他消息</text>
						<text>(0)</text>
					</view>
				</view>
			</view>
		</view> -->
		<view class="content">
			<view class="item" v-for="(item,index) in list" :key="index">
				<image src="@/static/message@1.png"></image>
				<view class="right">
					<view class="title_time">
						<view class="namebox">{{item.title}}</view>
						<view class="timebox">{{item.addtime|dateFormat}}</view>
					</view>
					<view class="text">
						{{item.desc}}
					</view>
				</view>
			</view>
			<!-- <view class="item">
				<image src="@/static/logo.png"></image>
				<view class="right">
					<view class="title_time">
						<text>中秋国庆双节同庆</text>
						<text>2023-05-03</text>
					</view>
					<view class="text">
						中秋国庆，普天同庆，优生活好礼相送，消...
					</view>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],

			};
		},
		onLoad() {
			this.getmsg()
		},
		filters:{
			//过滤器 用于格式化时间
			dateFormat: function(value) {           
			    var date = new Date(value*1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
			    var year = date.getFullYear();
			    var month = ("0" + (date.getMonth() + 1)).slice(-2);
			    var sdate = ("0" + date.getDate()).slice(-2);
			    var hour = ("0" + date.getHours()).slice(-2);
			    var minute = ("0" + date.getMinutes()).slice(-2);
			    var second = ("0" + date.getSeconds()).slice(-2);
			    // 拼接
			    var result = year + "-" + month + "-" + sdate + "-" + hour + ":" + minute //+ ":" + second;
			    // 返回
			    return result;
			},
		},
		methods: {
			// 跳转系统消息
			navSystemMessage() {
				uni.navigateTo({
					url: "/personalData/systemMessage/systemMessage"
				})
			},
			getmsg(){
				this.$http({
					url:'api/wechat/userMessageList'
				}).then(res=>{
					this.list = res.data
				})
			}
		}
	}
</script>
<style>
	.input_search {
		font-size: 28rpx;
		font-family: Source Han Sans CN-Regular, Source Han Sans CN;
		font-weight: 400;
		color: #888888;
		line-height: 1em;
	}
</style>
<style lang="scss" scoped>
	.top_box {
		width: 750rpx;
		height: 310rpx;
		background: #FFFFFF;
		border-radius: 0rpx 0rpx 20rpx 20rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		display: table;
		content: "";

		.search_box {
			width: 690rpx;
			height: 70rpx;
			margin-top: 28rpx;
			background: #FFFFFF;
			border-radius: 36rpx 36rpx 36rpx 36rpx;
			border: 2rpx solid #F94D29;
			display: flex;
			justify-content: space-between;
			align-items: center;
			gap: 0 16rpx;

			image {
				width: 33rpx;
				height: 28rpx;
				flex-shrink: 0;
				margin-left: 26rpx
			}

			input {
				width: 100%;
				height: 100%;
				line-height: 100%;
			}

			.btn {
				width: 112rpx;
				height: 70rpx;
				background: linear-gradient(180deg, #F94D29 0%, #F99529 100%);
				border-radius: 36rpx 36rpx 36rpx 36rpx;
				flex-shrink: 0;
				font-size: 28rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #F7F7F7;
				line-height: 1em;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}

		.message_box {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 40rpx;

			.message_item {
				width: 330rpx;
				height: 132rpx;
				background: rgba(249, 77, 41, 0.03);
				border-radius: 26rpx 26rpx 26rpx 26rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				gap: 0 20rpx;

				image {
					width: 72rpx;
					height: 72rpx;
				}

				.message {
					font-size: 28rpx;
					font-family: Source Han Sans CN-Medium, Source Han Sans CN;
					font-weight: 500;
					color: #222222;

					text:last-child {
						color: #888888;
					}
				}
			}
		}

	}

	.content {
		padding: 0 30rpx;
		box-sizing: border-box;
		margin-top: 24rpx;
		background: #FFFFFF;

		.item:last-child {
			border: none;
		}

		.item {
			width: 100%;
			height: 170rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 2rpx solid #F1F1F1;
			gap: 0 20rpx;



			image {
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				flex-shrink: 0;
			}

			.right {
				width: 100%;
				height: 90rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.title_time {
					display: flex;
					justify-content: space-between;
					align-items: center;
					.namebox{
						width: 360rpx;
						font-size: 30rpx;
						font-family: Source Han Sans CN-Medium, Source Han Sans CN;
						font-weight: 500;
						color: #222222;
						line-height: 1em;
						-webkit-line-clamp: 1;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						overflow: hidden;
						text-overflow: ellipsis;
					}
					.timebox{
						width: 220rpx;
						font-size: 24rpx;
						font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
						font-weight: normal;
						color: #888888;
						line-height: 1em;
					}

					// text:first-child {
					// 	font-size: 30rpx;
					// 	font-family: Source Han Sans CN-Medium, Source Han Sans CN;
					// 	font-weight: 500;
					// 	color: #222222;
					// 	line-height: 1em;
					// }

					// text:last-child {
					// 	font-size: 24rpx;
					// 	font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
					// 	font-weight: normal;
					// 	color: #888888;
					// 	line-height: 1em;
					// }
				}

				.text {
					font-size: 28rpx;
					font-family: Source Han Sans CN-Regular, Source Han Sans CN;
					font-weight: 400;
					color: #555555;
					line-height: 1em;
					-webkit-line-clamp: 1;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					overflow: hidden;
					text-overflow: ellipsis;
				}
			}
		}
	}
</style>
